| Server IP : 121.121.20.254 / Your IP : 216.73.216.133 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Program Files/LibreOffice/help/en-US/text/sbasic/shared/ |
Upload File : |
<!DOCTYPE html>
<html lang="en-US" dir="ltr">
<head>
<base href="../../../../">
<noscript><meta http-equiv="refresh" content="0; URL=../../../../en-US/noscript.html"></noscript>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>MsgBox Function</title>
<link rel="shortcut icon" href="media/navigation/favicon.ico">
<link type="text/css" href="normalize.css" rel="Stylesheet">
<link type="text/css" href="prism.css" rel="Stylesheet">
<link type="text/css" href="default.css" rel="Stylesheet">
<script type="text/javascript" src="polyfills.js"></script><script type="text/javascript" src="languages.js"></script><script type="text/javascript" src="en-US/langnames.js"></script><script type="text/javascript" src="flexsearch.debug.js"></script><script type="text/javascript" src="prism.js"></script><script type="text/javascript" src="help2.js" defer></script><script type="text/javascript" src="a11y-toggle.js" defer></script><script type="text/javascript" src="paginathing.js" defer></script><script type="text/javascript" src="en-US/bookmarks.js" defer></script><script type="text/javascript" src="en-US/contents.js" defer></script><script type="text/javascript" src="help.js" defer></script><meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body>
<header id="TopLeftHeader"><a class="symbol" href="en-US/text/shared/05/new_help.html"><div></div></a><a class="logo" href="en-US/text/shared/05/new_help.html"><p dir="auto">LibreOffice 24.2 Help</p></a><div class="dropdowns"><div class="modules">
<button type="button" data-a11y-toggle="modules-nav" id="modules" aria-haspopup="true" aria-expanded="false" aria-controls="modules-nav">Module</button><nav id="modules-nav" hidden=""></nav>
</div></div></header><aside class="leftside"><input id="accordion-1" name="accordion-menu" type="checkbox"><label for="accordion-1" dir="auto">Contents</label><div id="Contents" class="contents-treeview"></div></aside><div id="SearchFrame"><div id="Bookmarks">
<input id="search-bar" type="search" class="search" placeholder="Search in bookmarks for chosen module" dir="auto"><div class="nav-container" tabindex="0"><nav class="index" dir="auto"></nav></div>
</div></div>
<div id="DisplayArea" itemprop="softwareHelp" itemscope="true" itemtype="http://schema.org/SoftwareApplication">
<a name="msgbox"></a>
<a name="bm_id3153379"></a>
<meta itemprop="keywords" content="MsgBox function">
<h1 id="hd_id3153379" dir="auto">MsgBox Function</h1>
<p id="par_id3145171" class="paragraph" dir="auto">Displays a dialog box containing a message and returns a value.</p>
<div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
MsgBox (Prompt As String [,Buttons = MB_OK [,Title As String]]) As Integer
</code></pre></div>
<div class="embedded">
<a name="MsgBox_statement"></a>
<div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
<a name="parameters"></a>
<p id="par_id3148798" class="paragraph" dir="auto"> <span class="emph">prompt</span>: String expression displayed as a message in the dialog box. Line breaks can be inserted with Chr$(13).</p>
<p id="par_id3150769" class="paragraph" dir="auto"> <span class="emph">title</span>: String expression displayed in the title bar of the dialog. If omitted, the title bar displays the name of the respective application.</p>
<p id="par_id3147228" class="paragraph" dir="auto"> <span class="emph">buttons</span>: Any integer expression that specifies the dialog type, as well as the number and type of buttons to display, and the icon type. <span class="emph">buttons</span> represents a combination of bit patterns, that is, a combination of elements can be defined by adding their respective values:</p>
<a name="MsgBox_constants"></a>
<table border="1" class="" cellpadding="0" cellspacing="0">
<tr>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id051220170241588881" class="tableheadintable" dir="auto">Named constant</p>
</th>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id051220170241585541" class="tableheadintable" dir="auto">Integer value</p>
</th>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id051220170241585124" class="tableheadintable" dir="auto">Definition</p>
</th>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170241588348" class="tablecontentintable" dir="auto">MB_OK</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170241583191" class="tablecontentintable" dir="auto">0</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id3147397" class="paragraphintable" dir="auto">Display OK button only.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170241583930" class="tablecontentintable" dir="auto">MB_OKCANCEL</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170241598544" class="tablecontentintable" dir="auto">1</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id3145646" class="paragraphintable" dir="auto">Display OK and Cancel buttons.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170241591470" class="tablecontentintable" dir="auto">MB_ABORTRETRYIGNORE</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170241592832" class="tablecontentintable" dir="auto">2</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id3149410" class="paragraphintable" dir="auto">Display Abort, Retry, and Ignore buttons.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170241594311" class="tablecontentintable" dir="auto">MB_YESNOCANCEL</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170241594996" class="tablecontentintable" dir="auto">3</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id3151075" class="paragraphintable" dir="auto">Display Yes, No, and Cancel buttons.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170241596937" class="tablecontentintable" dir="auto">MB_YESNO</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170241592706" class="tablecontentintable" dir="auto">4</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id3153878" class="paragraphintable" dir="auto">Display Yes and No buttons.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170241591119" class="tablecontentintable" dir="auto">MB_RETRYCANCEL</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170241595093" class="tablecontentintable" dir="auto">5</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id3155601" class="paragraphintable" dir="auto">Display Retry and Cancel buttons.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id05122017024159933" class="tablecontentintable" dir="auto">MB_ICONSTOP</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id05122017024159655" class="tablecontentintable" dir="auto">16</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id3150716" class="paragraphintable" dir="auto">Add the Stop icon to the dialog.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170241591424" class="tablecontentintable" dir="auto">MB_ICONQUESTION</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170241593191" class="tablecontentintable" dir="auto">32</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id3153837" class="paragraphintable" dir="auto">Add the Question icon to the dialog.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170241598357" class="tablecontentintable" dir="auto">MB_ICONEXCLAMATION</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170242002870" class="tablecontentintable" dir="auto">48</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id3150751" class="paragraphintable" dir="auto">Add the Exclamation Point icon to the dialog.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170242001511" class="tablecontentintable" dir="auto">MB_ICONINFORMATION</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170242008091" class="tablecontentintable" dir="auto">64</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id3146915" class="paragraphintable" dir="auto">Add the Information icon to the dialog.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170242003564" class="tablecontentintable" dir="auto"> </p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170242001398" class="tablecontentintable" dir="auto">128</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id3145640" class="paragraphintable" dir="auto">First button in the dialog as default button.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170242007839" class="tablecontentintable" dir="auto">MB_DEFBUTTON2</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170242005589" class="tablecontentintable" dir="auto">256</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id3153765" class="paragraphintable" dir="auto">Second button in the dialog as default button.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170242005074" class="tablecontentintable" dir="auto">MB_DEFBUTTON3</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170242001655" class="tablecontentintable" dir="auto">512</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id3153715" class="paragraphintable" dir="auto">Third button in the dialog as default button.</p>
</td>
</tr>
</table>
<br>
</div>
<div class="embedded">
<a name="functvalue"></a>
<h3 id="hd_id061420171139087480" dir="auto">Return value:</h3>
</div>
<p id="par_id3146985" class="paragraph" dir="auto">Integer</p>
<table border="1" class="" cellpadding="0" cellspacing="0">
<tr>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id051220170330379805" class="tableheadintable" dir="auto">Named constant</p>
</th>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id051220170330387072" class="tableheadintable" dir="auto">Integer value</p>
</th>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id051220170330387973" class="tableheadintable" dir="auto">Definition</p>
</th>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170330388585" class="tablecontentintable" dir="auto">IDOK</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170330389516" class="tablecontentintable" dir="auto">1</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id3145230" class="paragraphintable" dir="auto"> OK</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170330381793" class="tablecontentintable" dir="auto">IDCANCEL</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170330388083" class="tablecontentintable" dir="auto">2</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id3149567" class="paragraphintable" dir="auto"> Cancel</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170330387992" class="tablecontentintable" dir="auto">IDABORT</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id05122017033038256" class="tablecontentintable" dir="auto">3</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id4056825" class="paragraphintable" dir="auto"> Abort</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170330383300" class="tablecontentintable" dir="auto">IDRETRY</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170330382200" class="tablecontentintable" dir="auto">4</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id3155335" class="paragraphintable" dir="auto"> Retry</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id0512201703303859" class="tablecontentintable" dir="auto">IDIGNORE</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170330388644" class="tablecontentintable" dir="auto">5</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id3146918" class="paragraphintable" dir="auto"> Ignore</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170330386652" class="tablecontentintable" dir="auto">IDYES</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170330387211" class="tablecontentintable" dir="auto">6</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id3155961" class="paragraphintable" dir="auto"> Yes</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170330381656" class="tablecontentintable" dir="auto">IDNO</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id051220170330383819" class="tablecontentintable" dir="auto">7</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id3148488" class="paragraphintable" dir="auto"> No</p>
</td>
</tr>
</table>
<br>
<div class="embedded">
<a name="errorcode"></a>
<h3 id="hd_id3152869" dir="auto">Error codes:</h3>
</div>
<div class="embedded"><p class="embedded" dir="auto">5 Invalid procedure call</p></div>
<h2 id="hd_id3150090" dir="auto">Example:</h2>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
Sub ExampleMsgBox
Dim sVar As Integer
sVar = MsgBox("Las Vegas")
sVar = MsgBox("Las Vegas",1)
sVar = MsgBox( "Las Vegas",256 + 16 + 2,"Dialog title")
sVar = MsgBox("Las Vegas", MB_DEFBUTTON2 + MB_ICONSTOP + MB_ABORTRETRYIGNORE, "Dialog title")
End Sub
</code></pre></div>
</div>
<div id="DonationFrame"></div>
<footer><div id="DEBUG" class="debug">
<h3 class="bug">Help content debug info:</h3>
<p dir="auto">This page is: <a href="https://opengrok.libreoffice.org/xref/help/source/text/sbasic/shared/03010102.xhp" target="_blank">/text/sbasic/shared/03010102.xhp</a></p>
<p dir="auto">Title is: MsgBox Function</p>
<p id="bm_module" dir="auto"></p>
<p id="bm_system" dir="auto"></p>
<p id="bm_HID" dir="auto"></p>
</div></footer>
</body>
</html>